package com.wkhyapp.lm.contract;

import com.wkhyapp.lm.base.BasePresenter;
import com.wkhyapp.lm.http.ApiCallback;
import com.wkhyapp.lm.http.net.GoodsListRequest;
import com.wkhyapp.lm.http.net.NoticeRequest;
import com.wkhyapp.lm.http.net.SuperResponse;
import com.wkhyapp.lm.http.vo.Goods;
import com.wkhyapp.lm.http.vo.Notice;

/**
 * Created by Administrator on 2021-10-1.
 */

public class DynamicPresenter extends BasePresenter<DynamicView> {


    boolean flag = true;

    public DynamicPresenter(DynamicView dynamicView) {
        super(dynamicView);
    }



    public void getData(){
        GoodsListRequest request = new GoodsListRequest();
        request.setPageNo(1);
        request.setPageSize(12);
        addSubscription(apiStores.goods(request),new ApiCallback<SuperResponse<Goods>>() {
            @Override
            public void onSuccess(SuperResponse<Goods> response) {
                mvpView.setGoods(response.getItems());
            }
            @Override
            public void onFailure(String msg) {
//                mvpView.setfail("");
            }

            @Override
            public void onFinish() {
                mvpView.dismissLoad();
            }
        });

    }



    public void getDataMore(int pageNo){
        GoodsListRequest request = new GoodsListRequest();
        request.setPageNo(pageNo);
        request.setPageSize(12);
        addSubscription(apiStores.goods(request),new ApiCallback<SuperResponse<Goods>>() {
            @Override
            public void onSuccess(SuperResponse<Goods> response) {
                mvpView.setGoodsMore(response.getItems());
            }
            @Override
            public void onFailure(String msg) {
//                mvpView.setfail("");
            }

            @Override
            public void onFinish() {
                mvpView.dismissLoad();
            }
        });
    }

}
